package com.qdlc.p2p.manage.action.additional;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

import javax.annotation.Resource;

import org.apache.struts2.convention.annotation.Action;

import com.opensymphony.xwork2.ModelDriven;
import com.qdlc.p2p.biz.service.NewActivityAwardLogService;
import com.qdlc.p2p.biz.web.action.BaseAction;
import com.qdlc.p2p.dal.common.model.jpa.PageDataList;
import com.qdlc.p2p.dal.model.NewActivityAwardLogModel;

/**
 * Created by liaoxiangkai on 2015/11/28.
 */
public class ManageNewActivityAwardLogAction extends BaseAction<NewActivityAwardLogModel> implements ModelDriven<NewActivityAwardLogModel> {
    @Resource
    private NewActivityAwardLogService newActivityAwardLogService;

    private NewActivityAwardLogModel model = new NewActivityAwardLogModel();
    @Override
    public NewActivityAwardLogModel getModel() {
        return model;
    }
    private Map<String, Object> data;

    @Action("/modules/additional/newActivityPlan/newActivityAwardLogManager")
    public String newActivityAwardLogManager(){
        return "newActivityAwardLogManager";
    }

    /**
     * 活动奖励列表查询
     * @throws IOException
     */
    @Action(value = "/modules/additional/newActivityPlan/newActivityAwardLogList")
    public void newActivityAwardLogList() throws IOException {
        data = new HashMap<String, Object>();
        PageDataList<NewActivityAwardLogModel> logList = newActivityAwardLogService.list(model);
        data.put("total", logList.getPage().getTotal());
        data.put("rows", logList.getList());
        printJson(getStringOfJpaObj(data));
    }
}
